package com.system.fastdfs.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.system.fastdfs.entity.CreditorInfo;
import com.system.fastdfs.service.CreditorInfoService;
import com.system.fastdfs.mapper.CreditorInfoMapper;
import com.system.fastdfs.util.FastDFSUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
* @author Admin
* @description 针对表【creditor_info】的数据库操作Service实现
* @createDate 2024-12-14 14:24:10
*/
@Service
public class CreditorInfoServiceImpl extends ServiceImpl<CreditorInfoMapper, CreditorInfo>
    implements CreditorInfoService{

    @Autowired
    CreditorInfoMapper creditorInfoMapper;
    @Override
    @Transactional
    public void deleteFileById(Integer id) {
        try{
            CreditorInfo creditorInfo = creditorInfoMapper.selectById(id);
            FastDFSUtil.delete(creditorInfo.getGroupname(),creditorInfo.getRemotefilepath());
            creditorInfoMapper.deleteById(id);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}




